home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
gfx
/
3d
/
T3DLIB_Src_R41.lha
/
tddd2nff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-12
|
1KB
|
60 lines
/* tddd2nff.c - convert TDDD (or TTDDD) file to NFF file
* - written by Glenn M. Lewis - 10/29/91
*/
static char rcs_id[] = "$Id: tddd2nff.c,v 1.6 1993/01/31 17:22:21 glewis Exp $";
#include <stdio.h>
#include "t3dlib.h"
#ifdef __STDC__
#include <stdlib.h>
#include <strings.h>
#include "tddd2nff_protos.h"
#endif
main(argc, argv)
int argc;
char *argv[];
{
char filename[256], rootname[256], *c1, *c2;
int i;
WORLD *world;
FILE *inp, *out;
filename[0] = '\0';
rootname[0] = '\0';
for (i=1; i<argc; i++) {
if (argv[i][0] == '-') {
if (argv[i][1] == 'h') {
fprintf(stderr, "Usage: %s [infile] [outfile]\n", argv[0]);
exit(-1);
}
fprintf(stderr, "Unknown option '%s' ignored.\n", argv[i]);
} else if (filename[0]) {
strcpy(rootname, argv[i]);
} else {
strcpy(filename, argv[i]); /* Make root of filename the default */
for (c1=rootname,c2=argv[i]; (*c1 = *c2++) && *c1!='.'; c1++) ;
*c1 = '\0';
strcat(rootname, ".nff");
}
}
if (!filename[0]) inp = stdin;
else if (!(inp = fopen(filename, "r"))) {
fprintf(stderr, "Can't open '%s' for input.\n", filename);
exit(-1);
}
if (!rootname[0]) out = stdout;
else if (!(out = fopen(rootname, "w"))) {
fprintf(stderr, "Can't open '%s' for output.\n", rootname);
exit(-1);
}
world = read_World(inp);
write_NFF(world, out);
free_World(world);
exit(0);
}